<?php
/**
 * Say class, talk a message to all chars o same room
 * @package action
 * @author alcaitiff
 */
class Say implements Action{
   	/**
     * @static
     * @var integer
     **/
	static private $tick;
    /**
     * @static
     * @var Char
     **/
	static private $char;
	/**
    *	Usage: say string
	*
	* @static
    * @param Command $command Command
    * @param int $tick Tick
    * @return String This command will return the message
    */
	static public function run($command,$tick){
		self::$tick=$tick;
		self::$char=$command->character;
        $parameters=$command->parameters;
        $line=$command->command;

        $message=implode(' ',$parameters);
        if($line=='say'){
            self::$char->getRoom()->broadcastMessage(self::$char->charId.' say:'.$message, self::$char);
            MessageSystem::addCharacterMessage('You say :'.$message);
        }else{
            self::$char->getRoom()->broadcastAreaMessage(self::$char->charId.' yell:'.$message, self::$char);
            MessageSystem::addCharacterMessage('You yell :'.$message);
        }
	}

}